package com.glsc.ngateway.common.api.shortmsg.bo;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Builder
@AllArgsConstructor
@NoArgsConstructor
@Data
@ApiModel("发送应⽤消息")
public class MessageGenericVo  implements Serializable {
    @NotNull
    @ApiModelProperty("应⽤agentId")
    private String agentId;

    @ApiModelProperty("接收消息成员OA账号")
    private List<String> oaUserAccounts;

    @ApiModelProperty("接收消息部⻔OA id")
    private List<Integer> oaDeptIds;

    @ApiModelProperty("接收消息标签id")
    private List<Integer> tagIds;

    @ApiModelProperty("消息类型，默认为text ")
    private String msgType;

    @ApiModelProperty("文本消息内容，支持超链接 ")
    private String textContent;

    /**注意这里的JsonAnySetter，
     * MessageGenericVo字段之外的属性都会设置到additionalProperties这个Map中。
     * * * */
    @Builder.Default
    @ApiModelProperty("消息内容与参数")
    private Map<String, Object> additionalProperties = new HashMap<>();

    @JsonAnySetter
    public void addAdditionalProperty(String key, Object value) {
        this.additionalProperties.put(key, value);
    }
    @JsonAnyGetter
    public Map<String, Object> getAdditionalProperties() {
        return additionalProperties;
    }
}
